﻿namespace X2OPC.Core.DA
{
    using System;
    using System.Runtime.InteropServices;

    [ComImport, ComVisible(true), Guid("5946DA93-8B39-4ec8-AB3D-AA73DF5BC86F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IOPCItemDeadbandMgt
    {
        /// <summary>
        /// 设置项对象的百分比死区值。对应于被设置死区值的项对象，为组对象设置的死区值无效
        /// </summary>
        /// <param name="dwCount"></param>
        /// <param name="phServer"></param>
        /// <param name="pPercentDeadband"></param>
        /// <param name="ppErrors"></param>
        /// <returns></returns>
        [PreserveSig]
        int SetItemDeadband([In] int dwCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] phServer, [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.R4, SizeParamIndex = 0)] float[] pPercentDeadband, out IntPtr ppErrors);

        /// <summary>
        /// //获取每一个被请求的项对象的死区值
        /// </summary>
        /// <param name="dwCount"></param>
        /// <param name="phServer"></param>
        /// <param name="ppPercentDeadband"></param>
        /// <param name="ppErrors"></param>
        /// <returns></returns>
        [PreserveSig]
        int GetItemDeadband([In] int dwCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] phServer, out IntPtr ppPercentDeadband, out IntPtr ppErrors);

        /// <summary>
        /// //清除项对象的百分比死区，可以使这些项对象有效的恢复回原来组对象设置的死区值
        /// </summary>
        /// <param name="dwCount"></param>
        /// <param name="phServer"></param>
        /// <param name="ppErrors"></param>
        /// <returns></returns>
        [PreserveSig]
        int ClearItemDeadband([In] int dwCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] phServer, out IntPtr ppErrors);
    }
}
